How to execute a function that returns a function inside of IO monad